﻿using SuperJoe.Framework.Core.Exceptions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace WWX.Admin.Web.Models
{
    public class PwdChangeVM
    {
        public string OldPwd { get; set; }

        public string NewPwd { get; set; }

        public string NewPwdConfirm { get; set; }

        public void Validate()
        {
            if (OldPwd.IsNullOrWhiteSpace())
            {
                ThrowHelper.ThrowFriendlyException("请输入旧密码");
            }

            if (NewPwd.IsNullOrWhiteSpace()) {
                ThrowHelper.ThrowFriendlyException("请输入新密码");
            }

            if (NewPwd != NewPwdConfirm)
            {
                ThrowHelper.ThrowFriendlyException("两次密码输入不同");
            }
        }
    }
}